# -*- coding: utf-8 -*-
# @Date：2024/7/18 16:57:07
# @Author：CJiaの青姝
# @FileName：models
# @Editor：PyCharm2024
# @Remark：
import random
from django.db import models
from utils.cj_jwt import DateTimeFieldFormat


class CoreModel(models.Model):
    """
    核心标准抽象模型模型,可直接继承使用
    增加审计字段, 覆盖字段时, 字段名称请勿修改, 必须统一审计字段名称
    """
    id = models.BigIntegerField(
        primary_key=True,
        auto_created=True,
        serialize=False,
        verbose_name='主键ID',
        help_text='主键ID',
    )
    sort = models.IntegerField(
        default=1,
        null=True,
        blank=True,
        verbose_name="显示排序",
        help_text="显示排序"
    )
    creator = models.CharField(
        max_length=255,
        null=True,
        blank=True,
        verbose_name='创建人',
        help_text="创建人",
    )
    modifier = models.CharField(
        max_length=255,
        null=True,
        blank=True,
        help_text="更新人",
        verbose_name="更新人"
    )
    remark = models.CharField(
        max_length=255,
        null=True,
        blank=True,
        verbose_name="备注",
        help_text="备注"
    )
    STATUS_CHOICES = (
        (True, "禁用"),
        (False, "启用"),
    )
    status = models.BooleanField(
        choices=STATUS_CHOICES,
        default=True,
        verbose_name="状态",
        help_text="状态"
    )
    create_time = DateTimeFieldFormat(
        null=True,
        blank=True,
        auto_now_add=True,
        editable=True,
        verbose_name="创建时间",
        help_text="创建时间"
    )
    update_time = DateTimeFieldFormat(
        null=True,
        blank=True,
        auto_now=True,
        editable=True,
        verbose_name="修改时间",
        help_text="修改时间",
    )

    class Meta:
        abstract = True
        verbose_name = '核心模型'
        verbose_name_plural = verbose_name
